Error 404
<?php
//var_dump($_SERVER);
//error_log('-->'.var_export($_SERVER, true));

$requestUrl = $_SERVER['REQUEST_URI'];
if (isset($_SERVER['HTTP_REFERER'])) {
	$referer = $_SERVER['HTTP_REFERER'];
	error_log('referer: '.$referer);
	$redirect = "";
	$hostEditUrl = 'http://localhost/abtester/edit/';
	if (stripos($referer, $hostEditUrl) !== false) {
		$editUrl = substr($referer, strlen($hostEditUrl));
		error_log('#######'.$editUrl.$requestUrl);
		$redirect = $editUrl.$requestUrl;
	}
	if ($redirect) {
		header("location: $redirect");
	} else {
		echo "Page not found.";
	}
} else {
	echo "Page not found.";
}
exit;
